<?php
$this->breadcrumbs = array (
		'Educators' 
);

?>

<div class="row">
	<div style="height: 550px; width: 100%">
		<img style="height: 550px; width: 100%" src="/images/educator.jpg" />


		
<?php

$form = $this->beginWidget ( 'bootstrap.widgets.TbActiveForm', array (
		'id' => 'educators-form',
		'enableAjaxValidation' => false,
		'htmlOptions' => array (
				'class' => 'well form-vertical',
				'style' => 'width: 400px; float: right; height: 200px; position: relative; top: -350px; right: 340px;' 
		) 
)
 );
?>
		
			<?php echo $form->textFieldRow($model,'cellphone',array('class'=>'span2','id'=>'verify_cellphone')); ?>
			<button class="btn getVerifyCode" type="button" name="yt2">获取验证码</button>
			
			<?php echo $form->textFieldRow($model,'verify_code',array('class'=>'span3')); ?>
			
			<label> </label>
		<button class="btn btn-primary" type="submit" name="yt2">绑定</button>
			
		<?php $this->endWidget(); ?>

	</div>
</div>



<script>
$(document).ready(function(){
	var time = 0;
	$(".getVerifyCode").click(function(){
		var _cellphone = $("#verify_cellphone").val();
		var _opt ={};
		_opt.url = '<?php echo $this->createUrl('/educators/verify')?>';
		_opt.type ='POST';
		_opt.data = {cellphone:_cellphone};
		_opt.success = function(){
			$(".getVerifyCode").attr("disabled",'disabled');
			time = 60;
			initNotice();
		}
		$.ajax(_opt);
	});

	function initNotice(){
		var _t =$(".getVerifyCode");
		if(!time){
			_t.text('获取验证码');
			_t.removeAttr("disabled");
			return true;
		}
		time--;
		var _t_msg = '重新发送（{time}）';
		_t_msg = _t_msg.replace('{time}',time);
		_t.text(_t_msg);
		setTimeout(initNotice,1000);
	}
	
})
</script>